package com.pjnkj.thunder.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.github.dreamyoung.mprelation.JoinColumn;
import com.github.dreamyoung.mprelation.ManyToOne;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 *
 * </p>
 *
 * @author pjnkj
 * @since 2022-01-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Order对象", description = "")
@TableName("`order`")
public class Order extends Model<Order> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "订单id")
    private String orderid;

    @JSONField(serialize = false)
    @ApiModelProperty(value = "商店id")
    private Integer shopid;

    @ManyToOne
    @JoinColumn(name = "shopid", referencedColumnName = "id")
    @ApiModelProperty(value = "店铺")
    @TableField(exist = false)
    private Shop shop;

    @ApiModelProperty(value = "订单状态")
    private Integer status;

    @ApiModelProperty(value = "返现金额")
    private String returnmoney;

    @ApiModelProperty(value = "达标金额")
    private String money;

    @JSONField(serialize = false)
    @ApiModelProperty(value = "支付状态")
    private String paystatus;

    @JSONField(serialize = false)
    @ApiModelProperty(value = "抢单时间")
    @TableField(value = "createTime", fill = FieldFill.INSERT)
    private Date createTime;

    @JSONField(serialize = false)
    @ApiModelProperty(value = "更新状态时间")
    @TableField(value = "lastModifiedTime", fill = FieldFill.INSERT_UPDATE)
    private Date lastModifiedTime;

    @JSONField(serialize = false)
    @ApiModelProperty(value = "任务id")
    private Integer taskid;

    @ManyToOne
    @JoinColumn(name = "taskid", referencedColumnName = "id")
    @ApiModelProperty(value = "任务")
    @TableField(exist = false)
    private Task task;

    @ApiModelProperty(value = "删除")
    @TableLogic
    private Integer deleted;

    @JSONField(serialize = false)
    @ApiModelProperty(value = "支付id")
    private Integer payid;

    @ApiModelProperty(value = "支付金额")
    private Integer paymoney;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
